/*
 * barrier.h
 *
 *  Created on: 06/06/2012
 *      Author: Roy
 */

#ifndef BARRIER_H_
#define BARRIER_H_

#include <pthread.h>
#include <assert.h>

struct sBarrier {
    int arrived;
    pthread_mutex_t barrierLock;
    pthread_cond_t reachedNumOfThreads;
};

typedef struct sBarrier barrier_t;

int barrier_init(barrier_t* barrier);

void barrier_destroy(barrier_t* barrier);

int barrier(barrier_t* barrier);

#endif /* BARRIER_H_ */
